package br.com.digicade.geosite.gpsavl.web;

import java.util.HashMap;
import java.util.Map;

import br.com.digicade.geosite.gpsavl.resource.SecurityResource;
import br.com.digicade.geosite.gpsavl.resource.impl.SecurityResourceImpl;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;

public class GuiceServletConfig extends GuiceServletContextListener {

    @Override
    protected Injector getInjector() {
        return Guice.createInjector(new ServletModule() {
            @Override
            protected void configureServlets() {

                bind(SecurityResource.class).to(SecurityResourceImpl.class);
                
                
                
                /**
                 * *******************SERVLET**********************
                 */
                
                Map<String, String> params = new HashMap<String, String>();
                params.put("com.sun.jersey.api.json.POJOMappingFeature", "true");
                serve("/rest/*").with(GuiceContainer.class, params);

                /**
                 * *******************SERVLET**********************
                 */

                /*filter("/*").through(SecurityFilter.class);*/
            }
        });
    }
}
